package com.crm.manager.controller;

import com.crm.common.core.domain.AjaxResult;
import com.crm.common.core.domain.R;
import com.crm.common.core.page.TableDataInfo;
import com.crm.manager.domain.dto.ClueRecordDto;
import com.crm.manager.service.ClueRecordService;
import com.crm.manager.service.ClueService;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@Slf4j
@RequestMapping("/clues")
public class ClueRecordController {
    @Autowired
    private ClueRecordService clueRecordService;


    // 添加跟进
    @PostMapping("/record")
    public R addClueRecord(@RequestBody ClueRecordDto clueRecordDto){
        log.info("添加跟进,接收到的参数是{}",clueRecordDto);
        clueRecordService.addClueRecord(clueRecordDto);
        return R.ok();
    }

    // 根据clueId查询线索跟进记录
    @GetMapping("/record/list")
    public TableDataInfo selectByClueId(Long clueId){
        log.info("根据clueId查询线索跟进记录,接受到的参数是{}",clueId);
        return clueRecordService.selectByClueId(clueId);
    }
}
